<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
<head>
    <title>进口B2B申报服务--规范申报管理</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'/>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <%@include file="/WEB-INF/pages/common/taglib.jsp" %>
    <%@include file="/WEB-INF/pages/common/common.jsp" %>
</head>
<body>
<div class="row-fluid" id="content-wrapper">
    <div class='span12'>
        <div class="row-fluid">
            <div class="span12">
                <div class="page-header">
                    <h1 class="pull-left">
                        <i class="icon-table"></i><span id="spanChange">规范申报管理</span>
                    </h1>

                    <div class="pull-right">
                        <ul class="breadcrumb">
                            <li><a><i class="icon-home"></i></a></li>
                            <li class="separator"><i class="icon-angle-right"></i></li>
                            <li class="active">进口B2B申报服务</li>
                            <li class="separator"><i class="icon-angle-right"></i></li>
                            <li class="active">规范申报管理</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class='row-fluid'>
            <div class='span12 box bordered-box orange-border' style='margin-bottom: 0;'>
                <div class='row-fluid'>
                    <div class='span12 box'>
                        <div class='box-header blue-background'>
                            <div class='title'>
                                <i class='icon-edit'></i>
                                基本查询信息
                            </div>
                        </div>
                        <div class='box-content'>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom: 10px;
                                    border-bottom: 1px solid #eee;">
                                <tr>
                                    <td style="text-align: left; padding-right: 10px; padding-left: 10px;">
                                        <button id="btnSearch" class='btn btn-primary btn-small'
                                                style='margin-bottom: 5px'>
                                            <i class='fa fa-search'></i>查 询
                                        </button>
                                        <button id="btnModify" class='btn btn-primary btn-small'
                                                style='margin-bottom: 5px'>
                                            <i class='icon-edit'></i>修 改
                                        </button>
                                        <button id="btnDelete" class='btn btn-primary btn-small'
                                                style='margin-bottom: 5px'>
                                            <i class='icon-remove'></i>删 除
                                        </button>
                                        <button id="btnDeclare" class='btn btn-primary btn-small'
                                                style='margin-bottom: 5px'>
                                            <i class='icon-arrow-up'></i>申 报
                                        </button>
                                        <button class='btn btn-primary btn-small'
                                                onclick="ClearAllInput('SearchTable')"
                                                style='margin-bottom: 5px'>
                                            <i class='icon-trash'></i>重 置
                                        </button>
                                    </td>
                                </tr>
                            </table>
                            <table id="SearchTable" width="100%" border="0" cellspacing="0" cellpadding="5">
                                <tr>
                                    <td style="width: 25%;">
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td class="titleCss">
                                                    清单编号
                                                </td>
                                                <td class="tdCss">
                                                    <input type="text" datafield="SearchTable.elistNo"/>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="width: 25%;">
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td class="titleCss">
                                                    账册编号
                                                </td>
                                                <td class="tdCss">
                                                    <input type="text" datafield="SearchTable.bookNo"/>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="width: 25%;">
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td class="titleCss">
                                                    订单号
                                                </td>
                                                <td class="tdCss">
                                                    <input type="text" datafield="SearchTable.orderNo"/>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="width: 25%;">
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td class="titleCss">
                                                    物流运单号
                                                </td>
                                                <td class="tdCss">
                                                    <input type="text" datafield="SearchTable.logisticsNo"/>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 25%;">
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td class="titleCss">
                                                    申报日期
                                                </td>
                                                <td class="tdCss">
                                                    <input type='text' style="width: 100%;" class="Wdate"
                                                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'declDateEnd\')}'})"
                                                           timeformat="YYYY-MM-DD HH:MM:SS" id="declDateStart"
                                                           datafield="SearchTable.declDateStart"/>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="width: 25%;">
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td class="titleCss">
                                                    至
                                                </td>
                                                <td class="tdCss">
                                                    <input type='text' style="width: 100%;" class="Wdate"
                                                           onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'declDateStart\')}'})"
                                                           timeformat="YYYY-MM-DD HH:MM:SS" id="declDateEnd"
                                                           datafield="SearchTable.declDateEnd"/>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="width: 25%;">
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td class="titleCss">
                                                    物流企业名称
                                                </td>
                                                <td class="tdCss">
                                                    <input type="text" datafield="SearchTable.logisticsName"/>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="width: 25%;">
                                        <table width="100%" border="0" cellspacing="10" cellpadding="0">
                                            <tr>
                                                <td class="titleCss">
                                                    提运单号
                                                </td>
                                                <td class="tdCss">
                                                    <input type="text" datafield="SearchTable.billNo"/>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
                <div class='responsive-table'>
                    <table id="corptable">
                    </table>
                    <div id="corptablePage">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function urlCode(cellvalue, options, rowObject) {
        var url = '${basePath}/declareDetail/declareDetail/' + rowObject.elistNo;
        return "<a class='btn-link' href=\"" + url + "\">" + "<span style='color:#00acec'>" + rowObject.elistNo + "</span></a>";
    }

    $(function () {
        $("#corptable").jqGrid({
            datatype: "json",
            url: $basePath + "/importB2B/standardDeclare/queryDeclareList",
            colNames: [
                'elistNo',
                '清单编号',
                '账册编号',
                '订单号',
                '物流运单号',
                '物流企业名称',
                '提运单号',
                '申报日期',
                '备注'
            ],
            colModel: [
                {name: 'elistNo', index: 'elistNo', hidden: true},
                {name: '', index: '', formatter: urlCode},
                {name: 'bookNo', index: 'bookNo'},
                {name: 'orderNo', index: 'orderNo'},
                {name: 'logisticsNo', index: 'logisticsNo'},
                {name: 'logisticsName', index: 'logisticsName'},
                {name: 'billNo', index: 'billNo'},
                {name: 'declDate', index: 'declDate'},
                {name: 'NOTE', index: 'NOTE'}
            ],
            viewrecords: true,
            autowidth: true,
            height: 'auto',
            shrinkToFit: false,
            autoScroll: true,
            rowNum: 10, //每页显示记录数
            rowList: [10, 20, 100], //可调整每页显示的记录数
            rownumbers: true,
            rownumWidth: 15,
            multiselect: true,
            pager: "#corptablePage", //分页工具栏
            sortname: "declDate",
            sortorder: "desc",
            loadComplete: function () {
                var rowNum = $(this).jqGrid('getGridParam', 'records');
                if (rowNum <= 0) {
                    if ($(this).parent().children('.norecords').length == 0)
                        $(this).parent().append("<div class=\"norecords\">暂无数据！</div>");
                    $(this).parent().children('.norecords').show();
                }
                else {
                    $(this).parent().children('.norecords').hide();
                }

                $("#corptable").setGridWidth($(window).width() * 0.98);
                $(".ui-jqgrid tr.ui-row-ltr td").css('text-align', 'center');
            }
        });
    });

    function reloadGrid() {
        var jsonStr = customFormToData("SearchTable");
        $("#corptable").jqGrid('setGridParam', {
            url: $basePath + "/importB2B/standardDeclare/queryDeclareList",
            postData: JSON.parse(jsonStr), //发送数据
            page: 1
        }).trigger("reloadGrid"); //重新载入
    }

    $(function () {
        $("#btnSearch").bind("click", function () {
            reloadGrid();
        });

        $("#btnModify").bind("click", function () {
            var jsonArr = getId("corptable");
            if (1 != jsonArr.length) {
                ShowMessages("对不起,您只能选中一条记录", "系统提示", "msgwaring", null, 0);
            } else {
                location.href = '${basePath}/declareDetail/declareDetail/' + jsonArr[0].elistNo;
            }
        });
    });
</script>
</body>
</html>
